import {
  uploadFileSync,
  downloadFile
} from '@/utils/request'


// 图片通用上传接口
export const imgUpload = formData => {
  return uploadFileSync({
    url: '/system/fileInfo/uploadImg',
    method: 'post',
    formData
  })
}


// 文件通用上传接口
export const fileUpload = formData => {
  return uploadFileSync({
    url: '/system/fileInfo/upload',
    method: 'post',
    formData
  })
}

// 文件通用下载接口
export const fileDownload = fileId => {
  var url = `system/fileInfo/download?fileId=${fileId}`;
  downloadFile(url);
}

// 二维码下载
export const qrCodeDownload = (codeId, size) => {
  var url = `system/code/download?codeId=${codeId}&size=${size}`;
  downloadFile(url);
}
// 二维码zip压缩文件下载
export const qrCodeBatchDownload = (filename) => {
  var url = `system/code/batchDownload?filename=${filename}`;
  downloadFile(url);
}
